import React, { useEffect } from 'react';
// @ts-ignore
import { useHwAuthControl, useCheckAuth } from 'umi';
import Test from '../components/Test';
const authDatas = {
  pp: ['pp'],
  dd: ['dd'],
  test: ['component:1:1', 'tttt', 'pp'],
};
const childAuthSource = {
  appKey: 'pp',
  path: '/pp',
  auth: 'pp',
  routes: [
    {
      path: '/pp/index',
      auth: 'index',
    },
  ],
};
const setAuthData = {
  appKeyList: ['pp', 'test', 'childPkey'],
  authData: JSON.stringify(authDatas),
  type: 1,
};
export default () => {
  const { init } = useHwAuthControl();
  useEffect(() => {
    init(setAuthData, childAuthSource);
  }, []);
  const auths = useCheckAuth({
    auth: [{ key: '/index/pp', authType: 'route' }],
    authKey: 'key',
    typeKey: 'authType',
    resultType: 'status',
  });
  console.log(auths);
  return (
    <div>
      <Test />
    </div>
  );
};
